using TMPro;
using UnityEngine;

public class CityBuildingUnlockTooltip : MonoBehaviour
{
	public TextMeshProUGUI Text;

	public GameObject Lock;

	public GameObject Gem;

	private Color _defaultColor = Color.white;

	private void Awake()
	{
		_defaultColor = Text.color;
	}

	public void Setup(int unlockLevel, int cost, bool available, bool hasEnoughMoney)
	{
		if (available)
		{
			Text.text = cost.ToString();
		}
		else
		{
			Text.text = "Level " + (unlockLevel + 1);
		}
		Lock.gameObject.SetActive(!available);
		Gem.gameObject.SetActive(available);
		Text.color = ((available && !hasEnoughMoney) ? Color.red : _defaultColor);
		base.gameObject.SetActive(value: true);
	}

	public void Hide()
	{
		base.gameObject.SetActive(value: false);
	}

	public void OnClick()
	{
		GetComponentInParent<CityBuildingElementHandler>().Select();
	}
}
